<?php
/**
* @version $Id: accounts.php
* @package Accounts
*/
/* Make sure this is not direct access */

defined('_JEXEC') or die('Restricted access');
/* Import the controller class */
jimport('joomla.application.component.controller');
/* Extend the JController class */
class AccountsControllerShow extends AccountsController
{
	/* If request is for display of a view, call parent method
	* so the view can be rendered.
	*/


	function __construct()
	{
		parent::__construct();
	}

	function show()
	{
		$model = $this->getModel('accounts');
		if(!$model->getData()) {
			$msg = $model->getError();
			$this->setRedirect( 'index.php?option=com_accounts&view=accounts&layout=form', $msg );
		} else {
			$user		=& JFactory::getUser();
			$layout = ($user->get('guest') ? 'unreg' : 'reg');
			JRequest::setVar( 'view', 'accounts' );
			JRequest::setVar( 'layout', $layout  );
			parent::display();
		}
	}

	function displaySecurityImagesCaptcha() {
        global $mainframe;
        $params =&		JComponentHelper::getParams( 'com_accounts' );
		$captcha = 		$params->get('useCheckSecurityImages');
        if ($captcha) {
        	$check = null;
        	$mainframe->triggerEvent('onSecurityImagesDisplay', array($check));
        	if (!$check) {
        		echo JText::_( 'GENERATE_CAPTCHA_ERROR' );
        	}
        }
	}
}
?>